1. Field
Exemplary embodiments relate to an apparatus and method for executing code.
2. Description of the Related Art
In a processor having an architecture without a parallel execution environment, program code with parallelism should be serialized and executed. One method for serializing program code is a work-item coalescing technique.
The method for coalescing the work-item enables all work-items included in one work-group to be transformed into a coalescing loop and executed in one computing unit. That is, to avoid an unexpected result caused by changing an execution order of program code by program code serialization, the method transforms each of a plurality of code regions, which is separated based on a barrier function, into a coalescing loop, and forces the processor to follow the execution order.
Using the method for coalescing the work-item, the data generated prior to the barrier function is only used within the corresponding coalescing loop. But after finishing execution of the coalescing loop, the data may not be retained in the coalescing loop. So every time the coalescing loop is executed, the data that needs to be retained with heap architecture is stored using dynamic memory allocation (malloc( )).
The method for coalescing the work-item generates overhead for dynamically allocating and returning memory. Also, in a processor with an architecture incapable of dynamic memory allocation, memory is consumed to store the data that needs to be retained.